home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
051-075
/
disk_052
/
tek4010
/
menu.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
13KB
|
418 lines
/***************************************************************
* vt100 - terminal emulator - initialization
*
* 860823 DBW - Integrated and rewrote lots of code
* v2.0 860809 DBW - Major rewrite
* v1.1 860720 DBW - Switches, 80 cols, colors, bug fixes
* v1.0 860712 DBW - First version released
*
***************************************************************/
#include "vt100.h"
/* this file contains all the declarations for the menu items, it is
these structures are used only in the menu module */
#define TKMAX 3 /* screen menu items */
struct MenuItem TKItem[TKMAX];
struct IntuiText TKText[TKMAX];
#define PRMAX 2
struct Menu PRMenu;
struct MenuItem PRItem[PRMAX];
struct IntuiText PRText[PRMAX];
#define SCMAX 2
struct Menu SCMenu;
struct MenuItem SCItem[SCMAX];
struct IntuiText SCText[SCMAX];
/* this macro sets a command key sequence for a menu item */
#define setseq(item, char) {\
item.Flags = item.Flags | COMMSEQ; \
item.Command = char;}
extern struct Window *TekWindow;
extern char *malloc();
/*****************************************************************/
/* The following function initializes the structure arrays */
/* needed to provide the File menu topic. */
/*****************************************************************/
void InitFileItems()
{
int n;
/* initialize each menu item and IntuiText with loop */
for( n=0; n<FILEMAX; n++ )
{
FileItem[n].NextItem = &FileItem[n+1];
FileItem[n].LeftEdge = 0;
FileItem[n].TopEdge = 11 * n;
FileItem[n].Width = 200;
FileItem[n].Height = 11;
FileItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
FileItem[n].MutualExclude = 0;
FileItem[n].ItemFill = (APTR)&FileText[n];
FileItem[n].SelectFill = NULL;
FileItem[n].Command = 0;
FileItem[n].SubItem = NULL;
FileItem[n].NextSelect = 0;
FileText[n].FrontPen = 0;
FileText[n].BackPen = 1;
FileText[n].DrawMode = JAM2; /* render in fore and background */
FileText[n].LeftEdge = 0;
FileText[n].TopEdge = 1;
FileText[n].ITextFont = NULL;
FileText[n].NextText = NULL;
}
FileItem[FILEMAX-1].NextItem = NULL;
/* initialize text for specific menu items */
FileText[0].IText = (UBYTE *)"Ascii Capture";
FileText[1].IText = (UBYTE *)"Ascii Send";
FileText[2].IText = (UBYTE *)"Xmodem Receive";
FileText[3].IText = (UBYTE *)"Xmodem Send";
FileText[4].IText = (UBYTE *)"Kermit Get";
setseq(FileItem[4], 'G');
FileText[5].IText = (UBYTE *)"Kermit Receive";
setseq(FileItem[5], 'R');
FileText[6].IText = (UBYTE *)"Kermit Send";
setseq(FileItem[6], 'S');
FileText[7].IText = (UBYTE *)"Kermit BYE";
setseq(FileItem[7], 'B');
}
/*****************************************************************/
/* The following function initializes the structure arrays */
/* needed to provide the BaudRate menu topic. */
/*****************************************************************/
void InitRSItems()
{
int n;
/* initialize each menu item and IntuiText with loop */
for( n=0; n<RSMAX; n++ )
{
RSItem[n].NextItem = &RSItem[n+1];
RSItem[n].LeftEdge = 0;
RSItem[n].TopEdge = 11 * n;
RSItem[n].Width = 65;
RSItem[n].Height = 11;
RSItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
RSItem[n].MutualExclude = (~(1 << n));
RSItem[n].ItemFill = (APTR)&RSText[n];
RSItem[n].SelectFill = NULL;
RSItem[n].Command = 0;
RSItem[n].SubItem = NULL;
RSItem[n].NextSelect = 0;
RSText[n].FrontPen = 0;
RSText[n].BackPen = 1;
RSText[n].DrawMode = JAM2; /* render in fore and background */
RSText[n].LeftEdge = 0;
RSText[n].TopEdge = 1;
RSText[n].ITextFont = NULL;
RSText[n].NextText = NULL;
}
RSItem[RSMAX-1].NextItem = NULL;
/* select baud item chekced */
n = -1;
switch (p_baud) {
case 300: n = 0; break;
case 1200: n = 1; break;
case 2400: n = 2; break;
case 4800: n = 3; break;
case 9600: n = 4; break;
case 19200: n = 5; break;
}
if (n != -1) RSItem[n].Flags =
ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED;
/* initialize text for specific menu items */
RSText[0].IText = (UBYTE *)" 300";
RSText[1].IText = (UBYTE *)" 1200";
RSText[2].IText = (UBYTE *)" 2400";
RSText[3].IText = (UBYTE *)" 4800";
RSText[4].IText = (UBYTE *)" 9600";
RSText[5].IText = (UBYTE *)" 19200";
}
/*****************************************************************/
/* The following function initializes the structure arrays */
/* needed to provide the Transfer Mode menu topic. */
/*****************************************************************/
void InitXFItems()
{
int n;
/* initialize each menu item and IntuiText with loop */
for( n=0; n<XFMAX; n++ )
{
XFItem[n].NextItem = &XFItem[n+1];
XFItem[n].LeftEdge = 0;
XFItem[n].TopEdge = 11 * n;
XFItem[n].Width = 85;
XFItem[n].Height = 11;
XFItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
XFItem[n].MutualExclude = (~(1 << n));
XFItem[n].ItemFill = (APTR)&XFText[n];
XFItem[n].SelectFill = NULL;
XFItem[n].Command = 0;
XFItem[n].SubItem = NULL;
XFItem[n].NextSelect = 0;
XFText[n].FrontPen = 0;
XFText[n].BackPen = 1;
XFText[n].DrawMode = JAM2; /* render in fore and background */
XFText[n].LeftEdge = 0;
XFText[n].TopEdge = 1;
XFText[n].ITextFont = NULL;
XFText[n].NextText = NULL;
}
XFItem[XFMAX-1].NextItem = NULL;
/* mode checked */
XFItem[p_mode].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED;
/* initialize text for specific menu items */
XFText[0].IText = (UBYTE *)" image";
XFText[1].IText = (UBYTE *)" CR LF";
}
/*****************************************************************/
/* The following function initializes the structure arrays */
/* needed to provide the Script menu topic. */
/*****************************************************************/
void InitScriptItems()
{
int n;
/* initialize each menu item and IntuiText with loop */
for( n=0; n<SCRIPTMAX; n++ )
{
ScriptItem[n].NextItem = &ScriptItem[n+1];
ScriptItem[n].LeftEdge = 0;
ScriptItem[n].TopEdge = 11 * n;
ScriptItem[n].Width = 170;
ScriptItem[n].Height = 11;
ScriptItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
ScriptItem[n].MutualExclude = 0;
ScriptItem[n].ItemFill = (APTR)&ScriptText[n];
ScriptItem[n].SelectFill = NULL;
ScriptItem[n].SubItem = NULL;
ScriptItem[n].NextSelect = 0;
ScriptText[n].FrontPen = 0;
ScriptText[n].BackPen = 1;
ScriptText[n].DrawMode = JAM2; /* render in fore and background */
ScriptText[n].LeftEdge = 0;
ScriptText[n].TopEdge = 1;
ScriptText[n].ITextFont = NULL;
ScriptText[n].NextText = NULL;
}
ScriptItem[SCRIPTMAX-1].NextItem = NULL;
/* initialize text for specific menu items */
ScriptText[0].IText = (UBYTE *)"Execute file";
setseq(ScriptItem[0], 'F');
ScriptText[1].IText = (UBYTE *)"Abort Execution";
setseq(ScriptItem[1], 'E');
}
/*****************************************************************/
/* The following function initializes the structure arrays */
/* needed to provide the Screen menu topic. */
/*****************************************************************/
void InitTEKItems()
{
int n;
/* initialize each menu item and IntuiText with loop */
for( n=0; n<TKMAX; n++ )
{
TKItem[n].NextItem = &TKItem[n+1];
TKItem[n].LeftEdge = 0;
TKItem[n].TopEdge = 11 * n;
TKItem[n].Width = 140;
TKItem[n].Height = 11;
TKItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP;
TKItem[n].MutualExclude = 0;
TKItem[n].ItemFill = (APTR)&TKText[n];
TKItem[n].SelectFill = NULL;
TKItem[n].SubItem = NULL;
TKItem[n].NextSelect = 0;
TKText[n].FrontPen = 0;
TKText[n].BackPen = 1;
TKText[n].DrawMode = JAM2; /* render in fore and background */
TKText[n].LeftEdge = 0;
TKText[n].TopEdge = 1;
TKText[n].ITextFont = NULL;
TKText[n].NextText = NULL;
}
TKItem[TKMAX-1].NextItem = NULL;
/* initialize text for specific menu items */
TKText[0].IText = (UBYTE *)" VT100";
setseq(TKItem[0], 'V');
TKText[1].IText = (UBYTE *)"TEK 4010";
setseq(TKItem[1], 'T');
TKText[2].IText = (UBYTE *)" Clear";
setseq(TKItem[2], 'C');
}
/**********************************************************************/
/* The following function initializes the Menu structure array with */
/* appropriate values for our simple menu strip. Review the manual */
/* if you need to know what each value means. */
/**********************************************************************/
void InitMenu()
{
InitFileItems();
menu[0].NextMenu = &menu[1];
menu[0].LeftEdge = 340;
menu[0].TopEdge = 0;
menu[0].Width = 100;
menu[0].Height = 10;
menu[0].Flags = MENUENABLED;
menu[0].MenuName = "File"; /* text for menu-bar display */
menu[0].FirstItem = &FileItem[0]; /* pointer to first item in list */
InitRSItems();
menu[1].NextMenu = &menu[2];
menu[1].LeftEdge = 0;
menu[1].TopEdge = 0;
menu[1].Width = 70;
menu[1].Height = 10;
menu[1].Flags = MENUENABLED;
menu[1].MenuName = " Baud"; /* text for menu-bar display */
menu[1].FirstItem = &RSItem[0]; /* pointer to first item in list */
InitXFItems();
menu[2].NextMenu = &menu[3];
menu[2].LeftEdge = 240;
menu[2].TopEdge = 0;
menu[2].Width = 100;
menu[2].Height = 10;
menu[2].Flags = MENUENABLED;
menu[2].MenuName = "Xfer Mode"; /* text for menu-bar display */
menu[2].FirstItem = &XFItem[0]; /* pointer to first item in list */
InitScriptItems();
menu[3].NextMenu = &menu[4];
menu[3].LeftEdge = 440;
menu[3].TopEdge = 0;
menu[3].Width = 100;
menu[3].Height = 10;
menu[3].Flags = MENUENABLED;
menu[3].MenuName = "Script"; /* text for menu-bar display */
menu[3].FirstItem = &ScriptItem[0]; /* pointer to first item in list */
InitTEKItems();
menu[4].NextMenu = &PRMenu;
menu[4].LeftEdge = 140;
menu[4].TopEdge = 0;
menu[4].Width = 100;
menu[4].Height = 10;
menu[4].Flags = MENUENABLED;
menu[4].MenuName = "Screen"; /* text for menu-bar display */
menu[4].FirstItem = &TKItem[0]; /* pointer to first item in list */
InitMore();
SetMenuStrip(mywindow,&menu[0]);
SetMenuStrip(TekWindow,&menu[0]);
}
/*****************************************************/
/* Menu Construction */
/*****************************************************/
InitMore()
{
register int n;
/* initialize the Misc. menu */
PRMenu.NextMenu = &SCMenu;
PRMenu.LeftEdge = 540;
PRMenu.TopEdge = 0;
PRMenu.Width = 90;
PRMenu.Height = 10;
PRMenu.Flags = MENUENABLED;
PRMenu.MenuName = "Misc.";
PRMenu.FirstItem = &PRItem[0];
/* initialize each menu item and IntuiText with loop */
for( n=0; n<PRMAX; n++ )
{
PRItem[n].NextItem = &PRItem[n+1];
PRItem[n].LeftEdge = -50;
PRItem[n].TopEdge = 11 * n;
PRItem[n].Width = 140;
PRItem[n].Height = 11;
PRItem[n].Flags = ITEMTEXT|ITEMENABLED|HIGHCOMP;
PRItem[n].MutualExclude = 0;
PRItem[n].ItemFill = (APTR)&PRText[n];
PRItem[n].SelectFill = NULL;
PRItem[n].Command = 0;
PRItem[n].SubItem = NULL;
PRItem[n].NextSelect = 0;
PRText[n].FrontPen = 0;
PRText[n].BackPen = 1;
PRText[n].DrawMode = JAM2; /* render in fore and background */
PRText[n].LeftEdge = 0;
PRText[n].TopEdge = 1;
PRText[n].ITextFont = NULL;
PRText[n].NextText = NULL;
}
PRItem[PRMAX-1].NextItem = NULL;
/* initialize text for specific menu items */
PRText[0].IText = (UBYTE *) " Quit";
setseq(PRItem[0], 'Q');
PRText[1].IText = (UBYTE *) "About";
SCMenu.NextMenu = NULL;
SCMenu.LeftEdge = 70;
SCMenu.TopEdge = 0;
SCMenu.Width = 70;
SCMenu.Height = 10;
SCMenu.Flags = MENUENABLED;
SCMenu.MenuName = "Scale";
SCMenu.FirstItem = &SCItem[0];
/* initialize each menu item and IntuiText with loop */
for( n=0; n<SCMAX; n++ )
{
SCItem[n].NextItem = &SCItem[n+1];
SCItem[n].LeftEdge = 0;
SCItem[n].TopEdge = 11 * n;
SCItem[n].Width = 85;
SCItem[n].Height = 11;
SCItem[n].Flags = ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT;
SCItem[n].MutualExclude = 0xFFFF - (1<<n);
SCItem[n].ItemFill = (APTR)&SCText[n];
SCItem[n].SelectFill = NULL;
SCItem[n].Command = 0;
SCItem[n].SubItem = NULL;
SCItem[n].NextSelect = 0;
SCText[n].FrontPen = 0;
SCText[n].BackPen = 1;
SCText[n].DrawMode = JAM2; /* render in fore and background */
SCText[n].LeftEdge = 0;
SCText[n].TopEdge = 1;
SCText[n].ITextFont = NULL;
SCText[n].NextText = NULL;
}
SCItem[SCMAX-1].NextItem = NULL;
/* initialize text for specific menu items */
SCText[0].IText = (UBYTE *)" 1024x780";
SCText[1].IText = (UBYTE *)" 640x400";
SCItem[TekScale].Flags = SCItem[0].Flags | CHECKED;
}